visualisation RJobDistanceMetric package

library(RJobDistanceMetric)
## Loading required package: mongolite
## Registered S3 method overwritten by 'params':
##   method            from 
##   print.knitr_kable knitr

using DependencyGraph

library(DependenciesGraphs)
## Loading required package: visNetwork
## Loading required package: shinydashboard
## 
## Attaching package: 'shinydashboard'
## The following object is masked from 'package:graphics':
## 
##     box
## Loading required package: XML
  • All dependencies between functions in an environment
# Prepare data
dep <- envirDependencies("package:RJobDistanceMetric")

# visualization
plot(dep,block=TRUE)
  • All dependencies from a function in an environment
# Prepare data
dep <- funDependencies("package:RJobDistanceMetric","calculate_distance_parameters")

# visualization
plot(dep)
  • Dependencies between (installed) packages
dep <- Pck.load.to.vis("RJobDistanceMetric")
plot(dep)
  • Explore your R with the shiny app
launch.app()

using mvbutils::foodwebr

#detach(package:foodwebr)
library(mvbutils)
## 
## Attaching package: 'mvbutils'
## The following object is masked from 'package:graphics':
## 
##     clip
## The following objects are masked from 'package:utils':
## 
##     ?, help
## The following objects are masked from 'package:base':
## 
##     print.default, print.function, rbind, rbind.data.frame
library(QualtricsTools) 
deps <- mvbutils::foodweb(where="package:RJobDistanceMetric")#, prune='make_split_coded_comments')

## [[1]]
## plot.foodweb
## 
## $x
## answer
## 
## $textcolor
## textcolor
## 
## $boxcolor
## boxcolor
## 
## $xblank
## xblank
## 
## $border
## border
## 
## $color.lines
## color.lines
## 
## $plotmath
## plotmath

using foodwebr - package

library(foodwebr)
## Registered S3 method overwritten by 'foodwebr':
##   method       from    
##   plot.foodweb mvbutils
## 
## Attaching package: 'foodwebr'
## The following object is masked from 'package:mvbutils':
## 
##     foodweb
#calculate_distance_parameters <- RJobDistanceMetric::calculate_distance_parameters

Calling plot() shows the graph (can’t upload images as this is my first post):

#plot(fw)

if (requireNamespace("RJobDistanceMetric", quietly = TRUE)) {
  
  fw <- foodwebr::foodweb(RJobDistanceMetric::calculate_distance_parameters)
  plot(fw)
}
if (requireNamespace("RJobDistanceMetric", quietly = TRUE)) {
  
  fw <- foodwebr::foodweb(RJobDistanceMetric::execute_RJob_distance_calculation)
  plot(fw)
}
if (requireNamespace("RJobDistanceMetric", quietly = TRUE)) {
  
  fw <- foodwebr::foodweb(RJobDistanceMetric::execute_RJob_mainscript)
  plot(fw)
}
if (requireNamespace("RJobDistanceMetric", quietly = TRUE)) {
  plot(foodweb(RJobDistanceMetric::create_distance_input, filter = FALSE))
}
  • create a tidygraph object (more plotting and analysis options)
if (requireNamespace("RJobDistanceMetric", quietly = TRUE)) {
  
  fw <- foodwebr::foodweb(RJobDistanceMetric::execute_RJob_distance_calculation)
  plot(fw)
}
if (requireNamespace("tidygraph", quietly = TRUE)) {
  tg <-fw%>%
     tidygraph::as_tbl_graph()
  tg
}
## # A tbl_graph: 33 nodes and 49 edges
## #
## # A directed acyclic simple graph with 1 component
## #
## # Node Data: 33 x 1 (active)
##   name                              
##   <chr>                             
## 1 execute_RJob_distance_calculation 
## 2 calculate_distance                
## 3 create_distance_input             
## 4 create_output_directory           
## 5 export_distance_results           
## 6 extract_distance_result_attributes
## # ... with 27 more rows
## #
## # Edge Data: 49 x 2
##    from    to
##   <int> <int>
## 1     1     2
## 2     1     3
## 3     1     4
## # ... with 46 more rows

using codeDepends

The CodeDepends package provides a flexible framework for statically analyzing R code (i.e., without evaluating it). It also contains higher-level functionality for: detecting dependencies between R code blocks or expressions, “tree-shaking” (pruning a script down to only the expressions necessary to evaluate a given expression), plotting variable usage timelines, and more.

library(CodeDepends)

The primary functions to perform basic code analysis are readScript which reads in R scripts of various forms (including .R and .Rmd files), and getInputs which performs the low-level code-analysis.

getInputs(quote(x <- y + rnorm(10, sd = z)))
## An object of class "ScriptNodeInfo"
## Slot "files":
## character(0)
## 
## Slot "strings":
## character(0)
## 
## Slot "libraries":
## character(0)
## 
## Slot "inputs":
## [1] "y" "z"
## 
## Slot "outputs":
## [1] "x"
## 
## Slot "updates":
## character(0)
## 
## Slot "functions":
##     + rnorm 
##    NA    NA 
## 
## Slot "removes":
## character(0)
## 
## Slot "nsevalVars":
## character(0)
## 
## Slot "sideEffects":
## character(0)
## 
## Slot "code":
## x <- y + rnorm(10, sd = z)
CD_input <- getInputs(RJobDistanceMetric::calculate_distance_parameters)
graph <- makeTaskGraph( info = getInputs(RJobDistanceMetric::calculate_distance_parameters))

The getInputs function accepts a collector argument, which essentially specifies a state tracker to be used when walking the code to collect inputs, functions called, etc.

col = inputCollector(library = function(e, collector, ...) {
    print(paste("Hello", asVarName(e)))
    defaultFuncHandlers$library(e, collector, ...)
})

#col = inputCollector(library = RJobDistanceMetric::create_distance_input)

getInputs(quote(library(RJobDistanceMetric)), collector = col)
## [1] "Hello RJobDistanceMetric"
## An object of class "ScriptNodeInfo"
## Slot "files":
## character(0)
## 
## Slot "strings":
## character(0)
## 
## Slot "libraries":
## [1] "RJobDistanceMetric"
## 
## Slot "inputs":
## character(0)
## 
## Slot "outputs":
## character(0)
## 
## Slot "updates":
## character(0)
## 
## Slot "functions":
## named logical(0)
## 
## Slot "removes":
## character(0)
## 
## Slot "nsevalVars":
## character(0)
## 
## Slot "sideEffects":
## character(0)
## 
## Slot "code":
## library(RJobDistanceMetric)
  • We can create the variable graph of dependnecies between variables, via the makeVariableGraph function:
 f = system.file("samples", "results-multi.R", package = "CodeDepends")
 sc = readScript(f)
 g = makeVariableGraph( info = getInputs(sc))
 if(require(Rgraphviz))
   plot(g)
## Loading required package: Rgraphviz
## Loading required package: graph
## Loading required package: BiocGenerics
## Loading required package: parallel
## 
## Attaching package: 'BiocGenerics'
## The following objects are masked from 'package:parallel':
## 
##     clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
##     clusterExport, clusterMap, parApply, parCapply, parLapply,
##     parLapplyLB, parRapply, parSapply, parSapplyLB
## The following objects are masked from 'package:mvbutils':
## 
##     pos, rbind
## The following objects are masked from 'package:stats':
## 
##     IQR, mad, sd, var, xtabs
## The following objects are masked from 'package:base':
## 
##     anyDuplicated, append, as.data.frame, basename, cbind, colnames,
##     dirname, do.call, duplicated, eval, evalq, Filter, Find, get, grep,
##     grepl, intersect, is.unsorted, lapply, Map, mapply, match, mget,
##     order, paste, pmax, pmax.int, pmin, pmin.int, Position, rank,
##     rbind, Reduce, rownames, sapply, setdiff, sort, table, tapply,
##     union, unique, unsplit, which, which.max, which.min
## 
## Attaching package: 'graph'
## The following object is masked from 'package:XML':
## 
##     addNode
## Loading required package: grid

 g = makeVariableGraph( info = getInputs(RJobDistanceMetric::create_distance_input))
 
if(require(Rgraphviz))
  plot(g)

  • We can also create call graphs for functions or entire packages:
library(RJobDistanceMetric)
  gg = makeCallGraph("package:RJobDistanceMetric")
  if(require(Rgraphviz)) {
     gg = layoutGraph(gg, layoutType = "circo")
     graph.par(list(nodes = list(fontsize=55)))
     renderGraph(gg) ## could also call plot directly
  } 

  • Finally we can display timelines for when variables are defined, redefined, and used:
#f = system.file("samples", "results-multi.R", package = "CodeDepends")
#sc = readScript(f)
#dtm = getDetailedTimelines(sc, getInputs(sc))
#plot(dtm) 
info <- getInputs(RJobDistanceMetric::execute_RJob_distance_calculation)
dtm = getDetailedTimelines(info = info)
plot(dtm) 

## [1] TRUE

using pkgnet

Exploring the Structure and Dependencies of an R Package

pkgnet is an R package designed for the analysis of R packages! The goal of the package is to build graph representations of a package’s various types of dependencies. This can inform a variety of activities, including:

prioritizing functions to unit test based on their centrality or influence
examining the recursive dependencies you are taking on by using a given package
exploring the structure of a new package provided by a coworker or downloaded from the internet
getwd()
## [1] "C:/Users/Ortmann/Documents"
library(pkgnet)
report1 <- CreatePackageReport(pkg_name = "RJobDistanceMetric",
                               pkg_path = file.path("Zellkraftwerk","packages","CANOPY","RJobDistanceMetric_CANOPY"))
## INFO [2022-01-19 19:50:06] Creating package report for package RJobDistanceMetric with reporters: SummaryReporter, DependencyReporter, FunctionReporter
## INFO [2022-01-19 19:50:06] Rendering package report...
## Warning in in_dir(input_dir(), evaluate(code, envir = env, new_device = FALSE, :
## You changed the working directory to C:/Users/Ortmann/Documents/R/R-3.6.3/
## library/pkgnet/package_report (probably via setwd()). It will be restored to C:/
## Users/Ortmann/Documents. See the Note section in ?knitr::knit
## INFO [2022-01-19 19:50:22] Done creating package report! It is available at C:\Users\Ortmann\AppData\Local\Temp\RtmpsraKWO\RJobDistanceMetric3a905bd53760.html
report1$FunctionReporter$get_summary_view()
g1 <- report1$FunctionReporter$pkg_graph

report1$InheritanceReporter
## NULL
report1$FunctionReporter$nodes
# Extract Nodes Table
funcNodes <- report1$FunctionReporter$nodes
funcNodes
# List Coverage For Most Depended-on Functions
mostRef <- funcNodes[order(numRecursiveRevDeps, decreasing = TRUE),]






# Get igraph object
funcGraph <- report1$FunctionReporter$pkg_graph$igraph
funcNames <- igraph::vertex_attr(funcGraph, name = "name")

# Jaccard Similarity
sim <- igraph::similarity(graph = funcGraph
                          , mode = "in"
                          , method = "jaccard")
diag(sim) <- 0
sim[sim < 1] <- 0

simGraph <- igraph::graph_from_adjacency_matrix(adjmatrix = sim, mode = "undirected")

# Find groups with same out-neighbors (similarity == 1)
sameDeps <- igraph::max_cliques(graph = simGraph
                                , min = 2
                                )

# Write results
for (i in seq_along(sameDeps)) {
    cat(paste0("Group ", i, ": "))
    cat(paste(funcNames[as.numeric(sameDeps[[i]])], collapse = ", "))
    cat("\n")
}
## Group 1: create_filename_distance_result, create_path_distance_result
## Group 2: subset_positions, subset_gates
## Group 3: create_gatePosTogate_distInput, create_gateTogate_distInput
## Group 4: create_data_all, create_data_coordinates
## Group 5: extract_chip_IDs, extract_gate_names, extract_paths_of_gates
## Group 6: set_attrs_full_input, export_full_input, merge_fl_and_gate_files
## Group 7: logging_parameters, logging_UIDs, logging_selections, logging_paths
## Group 8: create_distance_input, calculate_distance, extract_distance_result_attributes, export_distance_results, create_output_directory
## Group 9: remove_empty_positions, create_data_IDs_combination, subset_input, split_gate_combinations, determine_n_group, create_gate_combinations
## Group 10: import_R_Service_XML_file, check_imported_file_lists, tidy_up_XML_file_content, merge_all_input_files_to_one_list_and_export, import_all_gate_files, import_all_fl_files, extract_information_from_RService_XML, create_working_directory, copy_file_positionCSV, check_input_files
#------

# Jaccard Similarity
sim <- igraph::similarity(graph = funcGraph
                          , mode = "out"
                          , method = "jaccard")
diag(sim) <- 0
sim[sim < 1] <- 0

simGraph <- igraph::graph_from_adjacency_matrix(adjmatrix = sim, mode = "undirected")

# Find groups with same out-neighbors (similarity == 1)
sameDeps <- igraph::max_cliques(graph = simGraph
                                , min = 2
                                )

# Write results
for (i in seq_along(sameDeps)) {
    cat(paste0("Group ", i, ": "))
    cat(paste(funcNames[as.numeric(sameDeps[[i]])], collapse = ", "))
    cat("\n")
}
## Group 1: create_gateTogate_distInput, create_gatePosTogate_distInput
## Group 2: check_input_files, check.if.valid, validate_user_input, test_if_empty, list_dist_results, import_single_gate_file, extract_distance_result_attributes, check_imported_file_lists

using depgraph

Plot the complete dependency graph of an R package

library("depgraph")
library(RJobDistanceMetric)

plot_dependency_graph(
  pkg = "RJobDistanceMetric",
  suggests = FALSE)#,
 # option = "cividis"
#)

transformation objects to graph objects

#f = system.file(package = "RJobDistanceMetric")
f <- system.file ("samples", "dual.R", package = "CodeDepends")
sc = readScript(f)
 g = makeVariableGraph( info = getInputs(sc))
if(require(Rgraphviz))
plot(g)
library(tidyverse)
## -- Attaching packages --------------------------------------- tidyverse 1.3.1 --
## v ggplot2 3.3.5     v purrr   0.3.4
## v tibble  3.1.5     v dplyr   1.0.6
## v tidyr   1.1.3     v stringr 1.4.0
## v readr   2.0.2     v forcats 0.5.1
## -- Conflicts ------------------------------------------ tidyverse_conflicts() --
## x stringr::boundary() masks graph::boundary()
## x dplyr::combine()    masks BiocGenerics::combine()
## x dplyr::filter()     masks stats::filter()
## x dplyr::lag()        masks stats::lag()
## x ggplot2::Position() masks BiocGenerics::Position(), base::Position()
library(CodeDepends)
library(network)
## network: Classes for Relational Data
## Version 1.16.1 created on 2020-10-06.
## copyright (c) 2005, Carter T. Butts, University of California-Irvine
##                     Mark S. Handcock, University of California -- Los Angeles
##                     David R. Hunter, Penn State University
##                     Martina Morris, University of Washington
##                     Skye Bender-deMoll, University of Washington
##  For citation information, type citation("network").
##  Type help("network-package") to get started.
library(tidygraph)
## 
## Attaching package: 'tidygraph'
## The following object is masked from 'package:stats':
## 
##     filter
library(ggraph)
library(visNetwork)
library(networkD3)
library(RJobDistanceMetric)

#R Script
#________
#f<- file.path( "C:/Users/Ortmann/Documents/Zellkraftwerk/Projekte/morphosys_2020/R evaluations/R/assign_celltype_mapping_over_parameters_280121.R")
#sc = readScript(f)
#info <- getInputs(sc)

#R package function
#___________________
scf <- RJobDistanceMetric::calculate_distance_parameters
formals( scf)
## $From_IDs
## 
## 
## $To_IDs
## 
## 
## $filename
## NULL
## 
## $From_gate
## NULL
## 
## $To_gate
## NULL
## 
## $data_coordinates
## 
## 
## $knn
## [1] 1
## 
## $dist_summary
## [1] FALSE
## 
## $radius
## NULL
## 
## $export_knn
## [1] FALSE
## 
## $message
## [1] FALSE
## 
## $remove_zero_distances
## [1] TRUE
## 
## $output_dir
formalArgs(scf)
##  [1] "From_IDs"              "To_IDs"                "filename"             
##  [4] "From_gate"             "To_gate"               "data_coordinates"     
##  [7] "knn"                   "dist_summary"          "radius"               
## [10] "export_knn"            "message"               "remove_zero_distances"
## [13] "output_dir"
body(scf)
## {
##     Version <- 271021
##     tictoc::tic("calculate distance parameters")
##     gc()
##     Sys.setenv(R_MAX_VSIZE = 3.2e+10)
##     pos <- which(data_coordinates$cell_ID %in% From_IDs)
##     FROM <- data_coordinates[pos, ]
##     colnames(FROM) <- paste0("FROM_", colnames(FROM))
##     pos <- which(data_coordinates$cell_ID %in% To_IDs)
##     TO <- data_coordinates[pos, ]
##     colnames(TO) <- paste0("TO_", colnames(TO))
##     if (nrow(FROM) == 0 | nrow(TO) == 0) {
##         return(NULL)
##     }
##     df_crossing <- tidyr::crossing(FROM_cell_ID = FROM$FROM_cell_ID, 
##         TO_cell_ID = TO$TO_cell_ID)
##     check_totalamount <- (nrow(df_crossing) != (length(From_IDs) * 
##         length(To_IDs)))
##     if (all(check_totalamount, message)) {
##         if (length(From_IDs) == 0) {
##             From_IDs <- character(1)
##         }
##         if (length(To_IDs) == 0) {
##             To_IDs <- character(1)
##         }
##         writeLines(c("!NOTE!:", paste0("- amount total dist (", 
##             nrow(df_crossing), ") values do not fit the expectation of: ", 
##             length(From_IDs) * length(To_IDs))))
##     }
##     pos <- which((df_crossing$FROM_cell_ID == df_crossing$TO_cell_ID))
##     n_identical <- length(pos)
##     if (all(n_identical > 0, message)) {
##         writeLines(c(paste0("- amount of cell comparison pairs with identical cellIDs (zero distance): ", 
##             n_identical)))
##     }
##     if (all(remove_zero_distances, n_identical > 0)) {
##         df_crossing <- df_crossing[-pos, ]
##         if (message) {
##             writeLines(c(paste0("- successfully removed cellIDs producing zero distances")))
##         }
##     }
##     pos_FROM <- match(df_crossing$FROM_cell_ID, FROM$FROM_cell_ID)
##     pos_TO <- match(df_crossing$TO_cell_ID, TO$TO_cell_ID)
##     df_crossing$dist <- raster::pointDistance(cbind(FROM$FROM_ChipPosx[pos_FROM], 
##         FROM$FROM_ChipPosy[pos_FROM]), cbind(TO$TO_ChipPosx[pos_TO], 
##         TO$TO_ChipPosy[pos_TO]), lonlat = FALSE, allpairs = FALSE)
##     df_crossing$dist <- round(df_crossing$dist, digits = 1)
##     result <- df_crossing %>% tibble::as_tibble() %>% purrr::simplify()
##     result_knn <- result %>% dplyr::group_by(.data$FROM_cell_ID) %>% 
##         dplyr::arrange(.data$dist) %>% dplyr::slice(c(1:knn)) %>% 
##         dplyr::ungroup()
##     if (is.character(From_gate)) {
##         result_knn <- result_knn %>% dplyr::mutate(From_gate = From_gate)
##     }
##     if (is.character(To_gate)) {
##         result_knn <- result_knn %>% dplyr::mutate(To_gate = To_gate)
##     }
##     result_knn <- result_knn %>% dplyr::mutate(From_Position = stringr::str_split(.data$FROM_cell_ID, 
##         "_", simplify = TRUE)[, 2], To_Position = stringr::str_split(.data$TO_cell_ID, 
##         "_", simplify = TRUE)[, 2])
##     if (nrow(result_knn) == 0) {
##         print()
##     }
##     if (dist_summary) {
##         result_knn <- dplyr::left_join(result_knn, result %>% 
##             dplyr::group_by(.data$FROM_cell_ID) %>% dplyr::summarize(mean_dist = round(mean(.data$dist), 
##             digits = 2), median_dist = round(stats::median(.data$dist), 
##             digits = 2), .groups = "keep"), by = "FROM_cell_ID")
##     }
##     if (is.numeric(radius)) {
##         result_knn <- dplyr::left_join(result_knn, result %>% 
##             dplyr::group_by(.data$FROM_cell_ID) %>% dplyr::filter(.data$dist < 
##             radius) %>% dplyr::summarize(count_NN_radius = dplyr::n(), 
##             .groups = "keep") %>% dplyr::mutate(radius = radius) %>% 
##             dplyr::ungroup(), by = "FROM_cell_ID")
##         pos <- which(is.na(result_knn$count_NN_radius))
##         if (length(pos) > 0) {
##             result_knn$count_NN_radius[pos] <- 0
##             result_knn$radius[pos] <- radius
##         }
##     }
##     time <- tictoc::toc(quiet = TRUE)
##     attr(result_knn, "time_elapsed_sec") <- c(time$toc - time$tic)
##     attr(result_knn, "total_dist_values") <- nrow(df_crossing)
##     attr(result_knn, "result_filename") <- filename
##     attr(result_knn, "knn") <- knn
##     attr(result_knn, "radius") <- radius
##     n_cells_in_both_gates <- length(which(From_IDs %in% To_IDs))
##     attr(result_knn, "n_cells_in_both_gates") <- n_cells_in_both_gates
##     attr(result_knn, "amount zero distances") <- n_identical
##     attr(result_knn, "removed_zero_distances") <- remove_zero_distances
##     task <- "export"
##     if (export_knn) {
##         subtask <- "create_filename"
##         filename <- knn %>% create_filename_distance_result(radius, 
##             From_gate, To_gate, filename, name = "DistanceResults")
##         subtask <- "create_filpath"
##         filepath <- file.path(output_dir) %>% create_path_distance_result(From_gate, 
##             To_gate, message)
##         subtask <- "remove_files_in_result.dir"
##         file <- file.path(filepath, filename)
##         if (file.exists(file)) {
##             file.remove(file)
##             log_debug("Removed file {filename} in {filepath}.")
##         }
##         subtask <- "write_result_csv"
##         data.table::fwrite(result_knn, file)
##         subtask <- "check_result_export"
##         if (all(file.exists(file), message)) {
##             writeLines(c(paste0("- successful exported result file: ", 
##                 filename, " into ", filepath)))
##         }
##     }
##     check_resultamount <- (nrow(result_knn) != length(From_IDs) * 
##         knn)
##     if (all(check_resultamount, message)) {
##         writeLines(c("!NOTE!:", paste0("- amount of result values (", 
##             nrow(result_knn), ") ,do not fit the expectation of: ", 
##             length(From_IDs) * knn)))
##     }
##     return(result_knn)
## }
e <- environment(scf)
env.profile(e)
## $size
## [1] 97
## 
## $nchains
## [1] 65
## 
## $counts
##  [1] 0 1 2 1 0 0 2 2 0 2 0 0 0 2 1 1 0 1 2 1 3 2 1 0 2 3 0 2 0 1 0 1 2 0 3 1 0 1
## [39] 1 2 2 2 0 0 0 1 2 1 2 0 1 1 1 1 1 1 2 1 0 1 0 1 0 2 0 0 1 0 1 0 1 3 0 2 2 1
## [77] 0 3 2 1 1 1 1 0 0 0 2 0 0 3 2 3 3 2 1 1 0
switch("return", scf)
## function (From_IDs, To_IDs, filename = NULL, From_gate = NULL, 
##     To_gate = NULL, data_coordinates, knn = 1, dist_summary = FALSE, 
##     radius = NULL, export_knn = FALSE, message = FALSE, remove_zero_distances = TRUE, 
##     output_dir) 
## {
##     Version <- 271021
##     tictoc::tic("calculate distance parameters")
##     gc()
##     Sys.setenv(R_MAX_VSIZE = 3.2e+10)
##     pos <- which(data_coordinates$cell_ID %in% From_IDs)
##     FROM <- data_coordinates[pos, ]
##     colnames(FROM) <- paste0("FROM_", colnames(FROM))
##     pos <- which(data_coordinates$cell_ID %in% To_IDs)
##     TO <- data_coordinates[pos, ]
##     colnames(TO) <- paste0("TO_", colnames(TO))
##     if (nrow(FROM) == 0 | nrow(TO) == 0) {
##         return(NULL)
##     }
##     df_crossing <- tidyr::crossing(FROM_cell_ID = FROM$FROM_cell_ID, 
##         TO_cell_ID = TO$TO_cell_ID)
##     check_totalamount <- (nrow(df_crossing) != (length(From_IDs) * 
##         length(To_IDs)))
##     if (all(check_totalamount, message)) {
##         if (length(From_IDs) == 0) {
##             From_IDs <- character(1)
##         }
##         if (length(To_IDs) == 0) {
##             To_IDs <- character(1)
##         }
##         writeLines(c("!NOTE!:", paste0("- amount total dist (", 
##             nrow(df_crossing), ") values do not fit the expectation of: ", 
##             length(From_IDs) * length(To_IDs))))
##     }
##     pos <- which((df_crossing$FROM_cell_ID == df_crossing$TO_cell_ID))
##     n_identical <- length(pos)
##     if (all(n_identical > 0, message)) {
##         writeLines(c(paste0("- amount of cell comparison pairs with identical cellIDs (zero distance): ", 
##             n_identical)))
##     }
##     if (all(remove_zero_distances, n_identical > 0)) {
##         df_crossing <- df_crossing[-pos, ]
##         if (message) {
##             writeLines(c(paste0("- successfully removed cellIDs producing zero distances")))
##         }
##     }
##     pos_FROM <- match(df_crossing$FROM_cell_ID, FROM$FROM_cell_ID)
##     pos_TO <- match(df_crossing$TO_cell_ID, TO$TO_cell_ID)
##     df_crossing$dist <- raster::pointDistance(cbind(FROM$FROM_ChipPosx[pos_FROM], 
##         FROM$FROM_ChipPosy[pos_FROM]), cbind(TO$TO_ChipPosx[pos_TO], 
##         TO$TO_ChipPosy[pos_TO]), lonlat = FALSE, allpairs = FALSE)
##     df_crossing$dist <- round(df_crossing$dist, digits = 1)
##     result <- df_crossing %>% tibble::as_tibble() %>% purrr::simplify()
##     result_knn <- result %>% dplyr::group_by(.data$FROM_cell_ID) %>% 
##         dplyr::arrange(.data$dist) %>% dplyr::slice(c(1:knn)) %>% 
##         dplyr::ungroup()
##     if (is.character(From_gate)) {
##         result_knn <- result_knn %>% dplyr::mutate(From_gate = From_gate)
##     }
##     if (is.character(To_gate)) {
##         result_knn <- result_knn %>% dplyr::mutate(To_gate = To_gate)
##     }
##     result_knn <- result_knn %>% dplyr::mutate(From_Position = stringr::str_split(.data$FROM_cell_ID, 
##         "_", simplify = TRUE)[, 2], To_Position = stringr::str_split(.data$TO_cell_ID, 
##         "_", simplify = TRUE)[, 2])
##     if (nrow(result_knn) == 0) {
##         print()
##     }
##     if (dist_summary) {
##         result_knn <- dplyr::left_join(result_knn, result %>% 
##             dplyr::group_by(.data$FROM_cell_ID) %>% dplyr::summarize(mean_dist = round(mean(.data$dist), 
##             digits = 2), median_dist = round(stats::median(.data$dist), 
##             digits = 2), .groups = "keep"), by = "FROM_cell_ID")
##     }
##     if (is.numeric(radius)) {
##         result_knn <- dplyr::left_join(result_knn, result %>% 
##             dplyr::group_by(.data$FROM_cell_ID) %>% dplyr::filter(.data$dist < 
##             radius) %>% dplyr::summarize(count_NN_radius = dplyr::n(), 
##             .groups = "keep") %>% dplyr::mutate(radius = radius) %>% 
##             dplyr::ungroup(), by = "FROM_cell_ID")
##         pos <- which(is.na(result_knn$count_NN_radius))
##         if (length(pos) > 0) {
##             result_knn$count_NN_radius[pos] <- 0
##             result_knn$radius[pos] <- radius
##         }
##     }
##     time <- tictoc::toc(quiet = TRUE)
##     attr(result_knn, "time_elapsed_sec") <- c(time$toc - time$tic)
##     attr(result_knn, "total_dist_values") <- nrow(df_crossing)
##     attr(result_knn, "result_filename") <- filename
##     attr(result_knn, "knn") <- knn
##     attr(result_knn, "radius") <- radius
##     n_cells_in_both_gates <- length(which(From_IDs %in% To_IDs))
##     attr(result_knn, "n_cells_in_both_gates") <- n_cells_in_both_gates
##     attr(result_knn, "amount zero distances") <- n_identical
##     attr(result_knn, "removed_zero_distances") <- remove_zero_distances
##     task <- "export"
##     if (export_knn) {
##         subtask <- "create_filename"
##         filename <- knn %>% create_filename_distance_result(radius, 
##             From_gate, To_gate, filename, name = "DistanceResults")
##         subtask <- "create_filpath"
##         filepath <- file.path(output_dir) %>% create_path_distance_result(From_gate, 
##             To_gate, message)
##         subtask <- "remove_files_in_result.dir"
##         file <- file.path(filepath, filename)
##         if (file.exists(file)) {
##             file.remove(file)
##             log_debug("Removed file {filename} in {filepath}.")
##         }
##         subtask <- "write_result_csv"
##         data.table::fwrite(result_knn, file)
##         subtask <- "check_result_export"
##         if (all(file.exists(file), message)) {
##             writeLines(c(paste0("- successful exported result file: ", 
##                 filename, " into ", filepath)))
##         }
##     }
##     check_resultamount <- (nrow(result_knn) != length(From_IDs) * 
##         knn)
##     if (all(check_resultamount, message)) {
##         writeLines(c("!NOTE!:", paste0("- amount of result values (", 
##             nrow(result_knn), ") ,do not fit the expectation of: ", 
##             length(From_IDs) * knn)))
##     }
##     return(result_knn)
## }
## <bytecode: 0x000000001d8046e0>
## <environment: namespace:RJobDistanceMetric>
parent.env((e))
## <environment: 0x0000000013e26c10>
## attr(,"name")
## [1] "imports:RJobDistanceMetric"
info <- getInputs(scf)
info <- getInputs(RJobDistanceMetric::calculate_distance_parameters)
info <- getInputs("package:RJobDistanceMetric")
variables <- getVariables(info)
ls(e)
##  [1] "calculate_distance"                          
##  [2] "calculate_distance_parameters"               
##  [3] "check.if.valid"                              
##  [4] "check_element_of_vec1_in_vec2"               
##  [5] "check_imported_file_lists"                   
##  [6] "check_input_files"                           
##  [7] "chip_ID"                                     
##  [8] "cmd_args"                                    
##  [9] "connect_mongoDB"                             
## [10] "copy_file_positionCSV"                       
## [11] "count_cells_in_gates"                        
## [12] "create_data_all"                             
## [13] "create_data_coordinates"                     
## [14] "create_data_gates"                           
## [15] "create_data_IDs_combination"                 
## [16] "create_distance_input"                       
## [17] "create_filename_distance_result"             
## [18] "create_gate_combinations"                    
## [19] "create_gatePosTogate_distInput"              
## [20] "create_gateTogate_distInput"                 
## [21] "create_ID_combination_list"                  
## [22] "create_n_cells_gate"                         
## [23] "create_output_directory"                     
## [24] "create_path_distance_result"                 
## [25] "create_working_directory"                    
## [26] "create_XML_filename"                         
## [27] "create_XML_filepath_from_volume"             
## [28] "determine_length_per_list"                   
## [29] "determine_n_group"                           
## [30] "execute_RJob_distance_calculation"           
## [31] "execute_RJob_mainscript"                     
## [32] "export_distance_results"                     
## [33] "export_full_input"                           
## [34] "extract_chip_IDs"                            
## [35] "extract_dist_results"                        
## [36] "extract_distance_result_attributes"          
## [37] "extract_files_to_process"                    
## [38] "extract_gate_names"                          
## [39] "extract_gates_to_process"                    
## [40] "extract_information_from_RService_XML"       
## [41] "extract_jobtype"                             
## [42] "extract_paths_of_fl_files"                   
## [43] "extract_paths_of_gates"                      
## [44] "filling_rule"                                
## [45] "find_chip_path"                              
## [46] "find_RService_XML_on_imageserver"            
## [47] "find_server_path"                            
## [48] "gate_selection"                              
## [49] "gatenames"                                   
## [50] "handle_trycatch_error"                       
## [51] "helpers"                                     
## [52] "import_all_fl_files"                         
## [53] "import_all_gate_files"                       
## [54] "import_R_Service_XML_file"                   
## [55] "import_single_fl_file"                       
## [56] "import_single_gate_file"                     
## [57] "list_dist_results"                           
## [58] "list_sublist_selected_by_element_name"       
## [59] "load_mainscript_output"                      
## [60] "logging_entire_input"                        
## [61] "logging_parameters"                          
## [62] "logging_paths"                               
## [63] "logging_selections"                          
## [64] "logging_UIDs"                                
## [65] "merge_all_input_files_to_one_list_and_export"
## [66] "merge_fl_and_gate_files"                     
## [67] "ObligColumns"                                
## [68] "output_dir"                                  
## [69] "plot_distance_results"                       
## [70] "print_user_input"                            
## [71] "query_mongoDB"                               
## [72] "remove_chip_ID_from_list_names"              
## [73] "remove_empty_positions"                      
## [74] "remove_list_element_by_name"                 
## [75] "remove_string_from_list_names"               
## [76] "remove_values_from_vector"                   
## [77] "RJob_ID"                                     
## [78] "segment_ID"                                  
## [79] "set_attrs_full_input"                        
## [80] "split_gate_combinations"                     
## [81] "stop_if_fatal"                               
## [82] "stop_quietly"                                
## [83] "subset_gates"                                
## [84] "subset_input"                                
## [85] "subset_list_by_name"                         
## [86] "subset_positions"                            
## [87] "test_if_empty"                               
## [88] "tidy_up_XML_file_content"                    
## [89] "truncate_position_string"                    
## [90] "V"                                           
## [91] "validate_user_input"                         
## [92] "validate_XML_filepath"                       
## [93] "version.calculate_distance_parameters"       
## [94] "version.helpers.data_summary"                
## [95] "version.helpers.data_wrangling"              
## [96] "version.helpers.RJob_execution"              
## [97] "version.load_mainscript"                     
## [98] "write_lines_task"                            
## [99] "xml.dir"
call <- makeCallGraph("package:RJobDistanceMetric")

call
## A CallGraph graph with directed edges
## Number of Nodes = 54 
## Number of Edges = 61
call@nodes #Knotenliste
##  [1] "%>%"                                  
##  [2] "calculate_distance_parameters"        
##  [3] "check.if.valid"                       
##  [4] "check_element_of_vec1_in_vec2"        
##  [5] "connect_mongoDB"                      
##  [6] "copy_file_positionCSV"                
##  [7] "count_cells_in_gates"                 
##  [8] "create_data_all"                      
##  [9] "create_data_coordinates"              
## [10] "create_data_gates"                    
## [11] "create_data_IDs_combination"          
## [12] "create_distance_input"                
## [13] "create_filename_distance_result"      
## [14] "create_gate_combinations"             
## [15] "create_gatePosTogate_distInput"       
## [16] "create_gateTogate_distInput"          
## [17] "create_ID_combination_list"           
## [18] "create_n_cells_gate"                  
## [19] "create_path_distance_result"          
## [20] "create_XML_filename"                  
## [21] "create_XML_filepath_from_volume"      
## [22] "determine_length_per_list"            
## [23] "determine_n_group"                    
## [24] "execute_RJob_distance_calculation"    
## [25] "execute_RJob_mainscript"              
## [26] "extract_chip_IDs"                     
## [27] "extract_dist_results"                 
## [28] "extract_files_to_process"             
## [29] "extract_gate_names"                   
## [30] "extract_gates_to_process"             
## [31] "extract_jobtype"                      
## [32] "filling_rule"                         
## [33] "find_chip_path"                       
## [34] "find_RService_XML_on_imageserver"     
## [35] "find_server_path"                     
## [36] "handle_trycatch_error"                
## [37] "list_dist_results"                    
## [38] "list_sublist_selected_by_element_name"
## [39] "load_mainscript_output"               
## [40] "logging_entire_input"                 
## [41] "logging_parameters"                   
## [42] "logging_paths"                        
## [43] "logging_selections"                   
## [44] "logging_UIDs"                         
## [45] "plot_distance_results"                
## [46] "print_user_input"                     
## [47] "query_mongoDB"                        
## [48] "remove_chip_ID_from_list_names"       
## [49] "remove_list_element_by_name"          
## [50] "remove_string_from_list_names"        
## [51] "remove_values_from_vector"            
## [52] "subset_list_by_name"                  
## [53] "validate_user_input"                  
## [54] "write_lines_task"
call@edgeL #Kantenliste
## $`%>%`
## $`%>%`$edges
## integer(0)
## 
## 
## $calculate_distance_parameters
## $calculate_distance_parameters$edges
## [1]  1 13 19
## 
## 
## $check.if.valid
## $check.if.valid$edges
## integer(0)
## 
## 
## $check_element_of_vec1_in_vec2
## $check_element_of_vec1_in_vec2$edges
## integer(0)
## 
## 
## $connect_mongoDB
## $connect_mongoDB$edges
## integer(0)
## 
## 
## $copy_file_positionCSV
## $copy_file_positionCSV$edges
## [1] 1
## 
## 
## $count_cells_in_gates
## $count_cells_in_gates$edges
## [1] 1
## 
## 
## $create_data_all
## $create_data_all$edges
## [1]  1 48 49 52
## 
## 
## $create_data_coordinates
## $create_data_coordinates$edges
## [1] 1
## 
## 
## $create_data_gates
## $create_data_gates$edges
## [1]  1 48
## 
## 
## $create_data_IDs_combination
## $create_data_IDs_combination$edges
## [1] 1
## 
## 
## $create_distance_input
## $create_distance_input$edges
## [1]  8  9 10 11 14 18 23
## 
## 
## $create_filename_distance_result
## $create_filename_distance_result$edges
## [1] 1
## 
## 
## $create_gate_combinations
## $create_gate_combinations$edges
## [1]  1 18
## 
## 
## $create_gatePosTogate_distInput
## $create_gatePosTogate_distInput$edges
## [1] 10 13 19
## 
## 
## $create_gateTogate_distInput
## $create_gateTogate_distInput$edges
## [1] 10 13 19
## 
## 
## $create_ID_combination_list
## $create_ID_combination_list$edges
## integer(0)
## 
## 
## $create_n_cells_gate
## $create_n_cells_gate$edges
## [1] 1
## 
## 
## $create_path_distance_result
## $create_path_distance_result$edges
## [1] 1
## 
## 
## $create_XML_filename
## $create_XML_filename$edges
## integer(0)
## 
## 
## $create_XML_filepath_from_volume
## $create_XML_filepath_from_volume$edges
## [1] 20
## 
## 
## $determine_length_per_list
## $determine_length_per_list$edges
## [1] 1
## 
## 
## $determine_n_group
## $determine_n_group$edges
## [1] 1
## 
## 
## $execute_RJob_distance_calculation
## $execute_RJob_distance_calculation$edges
## [1] 12
## 
## 
## $execute_RJob_mainscript
## $execute_RJob_mainscript$edges
## [1] 6
## 
## 
## $extract_chip_IDs
## $extract_chip_IDs$edges
## integer(0)
## 
## 
## $extract_dist_results
## $extract_dist_results$edges
## [1] 1
## 
## 
## $extract_files_to_process
## $extract_files_to_process$edges
## integer(0)
## 
## 
## $extract_gate_names
## $extract_gate_names$edges
## integer(0)
## 
## 
## $extract_gates_to_process
## $extract_gates_to_process$edges
## integer(0)
## 
## 
## $extract_jobtype
## $extract_jobtype$edges
## integer(0)
## 
## 
## $filling_rule
## $filling_rule$edges
## integer(0)
## 
## 
## $find_chip_path
## $find_chip_path$edges
## [1]  1 35
## 
## 
## $find_RService_XML_on_imageserver
## $find_RService_XML_on_imageserver$edges
## [1] 20 33 35
## 
## 
## $find_server_path
## $find_server_path$edges
## [1]  1 47
## 
## 
## $handle_trycatch_error
## $handle_trycatch_error$edges
## integer(0)
## 
## 
## $list_dist_results
## $list_dist_results$edges
## integer(0)
## 
## 
## $list_sublist_selected_by_element_name
## $list_sublist_selected_by_element_name$edges
## integer(0)
## 
## 
## $load_mainscript_output
## $load_mainscript_output$edges
## [1]  1 54
## 
## 
## $logging_entire_input
## $logging_entire_input$edges
## [1] 41 42 43 44
## 
## 
## $logging_parameters
## $logging_parameters$edges
## integer(0)
## 
## 
## $logging_paths
## $logging_paths$edges
## integer(0)
## 
## 
## $logging_selections
## $logging_selections$edges
## integer(0)
## 
## 
## $logging_UIDs
## $logging_UIDs$edges
## integer(0)
## 
## 
## $plot_distance_results
## $plot_distance_results$edges
## [1] 1 8 9
## 
## 
## $print_user_input
## $print_user_input$edges
## integer(0)
## 
## 
## $query_mongoDB
## $query_mongoDB$edges
## [1] 5
## 
## 
## $remove_chip_ID_from_list_names
## $remove_chip_ID_from_list_names$edges
## [1]  1 50
## 
## 
## $remove_list_element_by_name
## $remove_list_element_by_name$edges
## [1]  1 51
## 
## 
## $remove_string_from_list_names
## $remove_string_from_list_names$edges
## integer(0)
## 
## 
## $remove_values_from_vector
## $remove_values_from_vector$edges
## integer(0)
## 
## 
## $subset_list_by_name
## $subset_list_by_name$edges
## [1] 4
## 
## 
## $validate_user_input
## $validate_user_input$edges
## integer(0)
## 
## 
## $write_lines_task
## $write_lines_task$edges
## [1]  1 32
call@edgeData #Kantenattribute
## An object of class "attrData"
## Slot "data":
## $`calculate_distance_parameters|%>%`
## $`calculate_distance_parameters|%>%`$weight
## [1] 1
## 
## 
## $`calculate_distance_parameters|create_filename_distance_result`
## $`calculate_distance_parameters|create_filename_distance_result`$weight
## [1] 1
## 
## 
## $`calculate_distance_parameters|create_path_distance_result`
## $`calculate_distance_parameters|create_path_distance_result`$weight
## [1] 1
## 
## 
## $`copy_file_positionCSV|%>%`
## $`copy_file_positionCSV|%>%`$weight
## [1] 1
## 
## 
## $`count_cells_in_gates|%>%`
## $`count_cells_in_gates|%>%`$weight
## [1] 1
## 
## 
## $`create_data_all|%>%`
## $`create_data_all|%>%`$weight
## [1] 1
## 
## 
## $`create_data_all|remove_chip_ID_from_list_names`
## $`create_data_all|remove_chip_ID_from_list_names`$weight
## [1] 1
## 
## 
## $`create_data_all|remove_list_element_by_name`
## $`create_data_all|remove_list_element_by_name`$weight
## [1] 1
## 
## 
## $`create_data_all|subset_list_by_name`
## $`create_data_all|subset_list_by_name`$weight
## [1] 1
## 
## 
## $`create_data_coordinates|%>%`
## $`create_data_coordinates|%>%`$weight
## [1] 1
## 
## 
## $`create_data_gates|%>%`
## $`create_data_gates|%>%`$weight
## [1] 1
## 
## 
## $`create_data_gates|remove_chip_ID_from_list_names`
## $`create_data_gates|remove_chip_ID_from_list_names`$weight
## [1] 1
## 
## 
## $`create_data_IDs_combination|%>%`
## $`create_data_IDs_combination|%>%`$weight
## [1] 1
## 
## 
## $`create_distance_input|create_data_all`
## $`create_distance_input|create_data_all`$weight
## [1] 1
## 
## 
## $`create_distance_input|create_data_coordinates`
## $`create_distance_input|create_data_coordinates`$weight
## [1] 1
## 
## 
## $`create_distance_input|create_data_gates`
## $`create_distance_input|create_data_gates`$weight
## [1] 1
## 
## 
## $`create_distance_input|create_data_IDs_combination`
## $`create_distance_input|create_data_IDs_combination`$weight
## [1] 1
## 
## 
## $`create_distance_input|create_gate_combinations`
## $`create_distance_input|create_gate_combinations`$weight
## [1] 1
## 
## 
## $`create_distance_input|create_n_cells_gate`
## $`create_distance_input|create_n_cells_gate`$weight
## [1] 1
## 
## 
## $`create_distance_input|determine_n_group`
## $`create_distance_input|determine_n_group`$weight
## [1] 1
## 
## 
## $`create_filename_distance_result|%>%`
## $`create_filename_distance_result|%>%`$weight
## [1] 1
## 
## 
## $`create_gate_combinations|%>%`
## $`create_gate_combinations|%>%`$weight
## [1] 1
## 
## 
## $`create_gate_combinations|create_n_cells_gate`
## $`create_gate_combinations|create_n_cells_gate`$weight
## [1] 1
## 
## 
## $`create_gatePosTogate_distInput|create_data_gates`
## $`create_gatePosTogate_distInput|create_data_gates`$weight
## [1] 1
## 
## 
## $`create_gatePosTogate_distInput|create_filename_distance_result`
## $`create_gatePosTogate_distInput|create_filename_distance_result`$weight
## [1] 1
## 
## 
## $`create_gatePosTogate_distInput|create_path_distance_result`
## $`create_gatePosTogate_distInput|create_path_distance_result`$weight
## [1] 1
## 
## 
## $`create_gateTogate_distInput|create_data_gates`
## $`create_gateTogate_distInput|create_data_gates`$weight
## [1] 1
## 
## 
## $`create_gateTogate_distInput|create_filename_distance_result`
## $`create_gateTogate_distInput|create_filename_distance_result`$weight
## [1] 1
## 
## 
## $`create_gateTogate_distInput|create_path_distance_result`
## $`create_gateTogate_distInput|create_path_distance_result`$weight
## [1] 1
## 
## 
## $`create_n_cells_gate|%>%`
## $`create_n_cells_gate|%>%`$weight
## [1] 1
## 
## 
## $`create_path_distance_result|%>%`
## $`create_path_distance_result|%>%`$weight
## [1] 1
## 
## 
## $`create_XML_filepath_from_volume|create_XML_filename`
## $`create_XML_filepath_from_volume|create_XML_filename`$weight
## [1] 1
## 
## 
## $`determine_length_per_list|%>%`
## $`determine_length_per_list|%>%`$weight
## [1] 1
## 
## 
## $`determine_n_group|%>%`
## $`determine_n_group|%>%`$weight
## [1] 1
## 
## 
## $`execute_RJob_distance_calculation|create_distance_input`
## $`execute_RJob_distance_calculation|create_distance_input`$weight
## [1] 1
## 
## 
## $`execute_RJob_mainscript|copy_file_positionCSV`
## $`execute_RJob_mainscript|copy_file_positionCSV`$weight
## [1] 1
## 
## 
## $`extract_dist_results|%>%`
## $`extract_dist_results|%>%`$weight
## [1] 1
## 
## 
## $`find_chip_path|%>%`
## $`find_chip_path|%>%`$weight
## [1] 1
## 
## 
## $`find_chip_path|find_server_path`
## $`find_chip_path|find_server_path`$weight
## [1] 1
## 
## 
## $`find_RService_XML_on_imageserver|create_XML_filename`
## $`find_RService_XML_on_imageserver|create_XML_filename`$weight
## [1] 1
## 
## 
## $`find_RService_XML_on_imageserver|find_chip_path`
## $`find_RService_XML_on_imageserver|find_chip_path`$weight
## [1] 1
## 
## 
## $`find_RService_XML_on_imageserver|find_server_path`
## $`find_RService_XML_on_imageserver|find_server_path`$weight
## [1] 1
## 
## 
## $`find_server_path|%>%`
## $`find_server_path|%>%`$weight
## [1] 1
## 
## 
## $`find_server_path|query_mongoDB`
## $`find_server_path|query_mongoDB`$weight
## [1] 1
## 
## 
## $`load_mainscript_output|%>%`
## $`load_mainscript_output|%>%`$weight
## [1] 1
## 
## 
## $`load_mainscript_output|write_lines_task`
## $`load_mainscript_output|write_lines_task`$weight
## [1] 1
## 
## 
## $`logging_entire_input|logging_parameters`
## $`logging_entire_input|logging_parameters`$weight
## [1] 1
## 
## 
## $`logging_entire_input|logging_paths`
## $`logging_entire_input|logging_paths`$weight
## [1] 1
## 
## 
## $`logging_entire_input|logging_selections`
## $`logging_entire_input|logging_selections`$weight
## [1] 1
## 
## 
## $`logging_entire_input|logging_UIDs`
## $`logging_entire_input|logging_UIDs`$weight
## [1] 1
## 
## 
## $`plot_distance_results|%>%`
## $`plot_distance_results|%>%`$weight
## [1] 1
## 
## 
## $`plot_distance_results|create_data_all`
## $`plot_distance_results|create_data_all`$weight
## [1] 1
## 
## 
## $`plot_distance_results|create_data_coordinates`
## $`plot_distance_results|create_data_coordinates`$weight
## [1] 1
## 
## 
## $`query_mongoDB|connect_mongoDB`
## $`query_mongoDB|connect_mongoDB`$weight
## [1] 1
## 
## 
## $`remove_chip_ID_from_list_names|%>%`
## $`remove_chip_ID_from_list_names|%>%`$weight
## [1] 1
## 
## 
## $`remove_chip_ID_from_list_names|remove_string_from_list_names`
## $`remove_chip_ID_from_list_names|remove_string_from_list_names`$weight
## [1] 1
## 
## 
## $`remove_list_element_by_name|%>%`
## $`remove_list_element_by_name|%>%`$weight
## [1] 1
## 
## 
## $`remove_list_element_by_name|remove_values_from_vector`
## $`remove_list_element_by_name|remove_values_from_vector`$weight
## [1] 1
## 
## 
## $`subset_list_by_name|check_element_of_vec1_in_vec2`
## $`subset_list_by_name|check_element_of_vec1_in_vec2`$weight
## [1] 1
## 
## 
## $`write_lines_task|%>%`
## $`write_lines_task|%>%`$weight
## [1] 1
## 
## 
## $`write_lines_task|filling_rule`
## $`write_lines_task|filling_rule`$weight
## [1] 1
## 
## 
## 
## Slot "defaults":
## $weight
## [1] 1
call@nodeData #Knotenattribute
## An object of class "attrData"
## Slot "data":
## $`%>%`
## $`%>%`$package
## [1] "RJobDistanceMetric"
## 
## 
## $calculate_distance_parameters
## $calculate_distance_parameters$package
## [1] "RJobDistanceMetric"
## 
## 
## $check.if.valid
## $check.if.valid$package
## [1] "RJobDistanceMetric"
## 
## 
## $check_element_of_vec1_in_vec2
## $check_element_of_vec1_in_vec2$package
## [1] "RJobDistanceMetric"
## 
## 
## $connect_mongoDB
## $connect_mongoDB$package
## [1] "RJobDistanceMetric"
## 
## 
## $copy_file_positionCSV
## $copy_file_positionCSV$package
## [1] "RJobDistanceMetric"
## 
## 
## $count_cells_in_gates
## $count_cells_in_gates$package
## [1] "RJobDistanceMetric"
## 
## 
## $create_data_all
## $create_data_all$package
## [1] "RJobDistanceMetric"
## 
## 
## $create_data_coordinates
## $create_data_coordinates$package
## [1] "RJobDistanceMetric"
## 
## 
## $create_data_gates
## $create_data_gates$package
## [1] "RJobDistanceMetric"
## 
## 
## $create_data_IDs_combination
## $create_data_IDs_combination$package
## [1] "RJobDistanceMetric"
## 
## 
## $create_distance_input
## $create_distance_input$package
## [1] "RJobDistanceMetric"
## 
## 
## $create_filename_distance_result
## $create_filename_distance_result$package
## [1] "RJobDistanceMetric"
## 
## 
## $create_gate_combinations
## $create_gate_combinations$package
## [1] "RJobDistanceMetric"
## 
## 
## $create_gatePosTogate_distInput
## $create_gatePosTogate_distInput$package
## [1] "RJobDistanceMetric"
## 
## 
## $create_gateTogate_distInput
## $create_gateTogate_distInput$package
## [1] "RJobDistanceMetric"
## 
## 
## $create_ID_combination_list
## $create_ID_combination_list$package
## [1] "RJobDistanceMetric"
## 
## 
## $create_n_cells_gate
## $create_n_cells_gate$package
## [1] "RJobDistanceMetric"
## 
## 
## $create_path_distance_result
## $create_path_distance_result$package
## [1] "RJobDistanceMetric"
## 
## 
## $create_XML_filename
## $create_XML_filename$package
## [1] "RJobDistanceMetric"
## 
## 
## $create_XML_filepath_from_volume
## $create_XML_filepath_from_volume$package
## [1] "RJobDistanceMetric"
## 
## 
## $determine_length_per_list
## $determine_length_per_list$package
## [1] "RJobDistanceMetric"
## 
## 
## $determine_n_group
## $determine_n_group$package
## [1] "RJobDistanceMetric"
## 
## 
## $execute_RJob_distance_calculation
## $execute_RJob_distance_calculation$package
## [1] "RJobDistanceMetric"
## 
## 
## $execute_RJob_mainscript
## $execute_RJob_mainscript$package
## [1] "RJobDistanceMetric"
## 
## 
## $extract_chip_IDs
## $extract_chip_IDs$package
## [1] "RJobDistanceMetric"
## 
## 
## $extract_dist_results
## $extract_dist_results$package
## [1] "RJobDistanceMetric"
## 
## 
## $extract_files_to_process
## $extract_files_to_process$package
## [1] "RJobDistanceMetric"
## 
## 
## $extract_gate_names
## $extract_gate_names$package
## [1] "RJobDistanceMetric"
## 
## 
## $extract_gates_to_process
## $extract_gates_to_process$package
## [1] "RJobDistanceMetric"
## 
## 
## $extract_jobtype
## $extract_jobtype$package
## [1] "RJobDistanceMetric"
## 
## 
## $filling_rule
## $filling_rule$package
## [1] "RJobDistanceMetric"
## 
## 
## $find_chip_path
## $find_chip_path$package
## [1] "RJobDistanceMetric"
## 
## 
## $find_RService_XML_on_imageserver
## $find_RService_XML_on_imageserver$package
## [1] "RJobDistanceMetric"
## 
## 
## $find_server_path
## $find_server_path$package
## [1] "RJobDistanceMetric"
## 
## 
## $handle_trycatch_error
## $handle_trycatch_error$package
## [1] "RJobDistanceMetric"
## 
## 
## $list_dist_results
## $list_dist_results$package
## [1] "RJobDistanceMetric"
## 
## 
## $list_sublist_selected_by_element_name
## $list_sublist_selected_by_element_name$package
## [1] "RJobDistanceMetric"
## 
## 
## $load_mainscript_output
## $load_mainscript_output$package
## [1] "RJobDistanceMetric"
## 
## 
## $logging_entire_input
## $logging_entire_input$package
## [1] "RJobDistanceMetric"
## 
## 
## $logging_parameters
## $logging_parameters$package
## [1] "RJobDistanceMetric"
## 
## 
## $logging_paths
## $logging_paths$package
## [1] "RJobDistanceMetric"
## 
## 
## $logging_selections
## $logging_selections$package
## [1] "RJobDistanceMetric"
## 
## 
## $logging_UIDs
## $logging_UIDs$package
## [1] "RJobDistanceMetric"
## 
## 
## $plot_distance_results
## $plot_distance_results$package
## [1] "RJobDistanceMetric"
## 
## 
## $print_user_input
## $print_user_input$package
## [1] "RJobDistanceMetric"
## 
## 
## $query_mongoDB
## $query_mongoDB$package
## [1] "RJobDistanceMetric"
## 
## 
## $remove_chip_ID_from_list_names
## $remove_chip_ID_from_list_names$package
## [1] "RJobDistanceMetric"
## 
## 
## $remove_list_element_by_name
## $remove_list_element_by_name$package
## [1] "RJobDistanceMetric"
## 
## 
## $remove_string_from_list_names
## $remove_string_from_list_names$package
## [1] "RJobDistanceMetric"
## 
## 
## $remove_values_from_vector
## $remove_values_from_vector$package
## [1] "RJobDistanceMetric"
## 
## 
## $subset_list_by_name
## $subset_list_by_name$package
## [1] "RJobDistanceMetric"
## 
## 
## $validate_user_input
## $validate_user_input$package
## [1] "RJobDistanceMetric"
## 
## 
## $write_lines_task
## $write_lines_task$package
## [1] "RJobDistanceMetric"
## 
## 
## 
## Slot "defaults":
## $package
## [1] ""
col <- inputCollector()
call_var = makeVariableGraph( info = info)

call_var
## A graphNEL graph with directed edges
## Number of Nodes = 0 
## Number of Edges = 0
call_var@nodes
## character(0)
call_var@edgeL
## named list()
ig<- igraph::graph_from_graphnel(call)

edgelist<-igraph::as_edgelist(ig)
edgelist
##       [,1]                                [,2]                             
##  [1,] "calculate_distance_parameters"     "%>%"                            
##  [2,] "calculate_distance_parameters"     "create_filename_distance_result"
##  [3,] "calculate_distance_parameters"     "create_path_distance_result"    
##  [4,] "copy_file_positionCSV"             "%>%"                            
##  [5,] "count_cells_in_gates"              "%>%"                            
##  [6,] "create_data_all"                   "%>%"                            
##  [7,] "create_data_all"                   "remove_chip_ID_from_list_names" 
##  [8,] "create_data_all"                   "remove_list_element_by_name"    
##  [9,] "create_data_all"                   "subset_list_by_name"            
## [10,] "create_data_coordinates"           "%>%"                            
## [11,] "create_data_gates"                 "%>%"                            
## [12,] "create_data_gates"                 "remove_chip_ID_from_list_names" 
## [13,] "create_data_IDs_combination"       "%>%"                            
## [14,] "create_distance_input"             "create_data_all"                
## [15,] "create_distance_input"             "create_data_coordinates"        
## [16,] "create_distance_input"             "create_data_gates"              
## [17,] "create_distance_input"             "create_data_IDs_combination"    
## [18,] "create_distance_input"             "create_gate_combinations"       
## [19,] "create_distance_input"             "create_n_cells_gate"            
## [20,] "create_distance_input"             "determine_n_group"              
## [21,] "create_filename_distance_result"   "%>%"                            
## [22,] "create_gate_combinations"          "%>%"                            
## [23,] "create_gate_combinations"          "create_n_cells_gate"            
## [24,] "create_gatePosTogate_distInput"    "create_data_gates"              
## [25,] "create_gatePosTogate_distInput"    "create_filename_distance_result"
## [26,] "create_gatePosTogate_distInput"    "create_path_distance_result"    
## [27,] "create_gateTogate_distInput"       "create_data_gates"              
## [28,] "create_gateTogate_distInput"       "create_filename_distance_result"
## [29,] "create_gateTogate_distInput"       "create_path_distance_result"    
## [30,] "create_n_cells_gate"               "%>%"                            
## [31,] "create_path_distance_result"       "%>%"                            
## [32,] "create_XML_filepath_from_volume"   "create_XML_filename"            
## [33,] "determine_length_per_list"         "%>%"                            
## [34,] "determine_n_group"                 "%>%"                            
## [35,] "execute_RJob_distance_calculation" "create_distance_input"          
## [36,] "execute_RJob_mainscript"           "copy_file_positionCSV"          
## [37,] "extract_dist_results"              "%>%"                            
## [38,] "find_chip_path"                    "%>%"                            
## [39,] "find_chip_path"                    "find_server_path"               
## [40,] "find_RService_XML_on_imageserver"  "create_XML_filename"            
## [41,] "find_RService_XML_on_imageserver"  "find_chip_path"                 
## [42,] "find_RService_XML_on_imageserver"  "find_server_path"               
## [43,] "find_server_path"                  "%>%"                            
## [44,] "find_server_path"                  "query_mongoDB"                  
## [45,] "load_mainscript_output"            "%>%"                            
## [46,] "load_mainscript_output"            "write_lines_task"               
## [47,] "logging_entire_input"              "logging_parameters"             
## [48,] "logging_entire_input"              "logging_paths"                  
## [49,] "logging_entire_input"              "logging_selections"             
## [50,] "logging_entire_input"              "logging_UIDs"                   
## [51,] "plot_distance_results"             "%>%"                            
## [52,] "plot_distance_results"             "create_data_all"                
## [53,] "plot_distance_results"             "create_data_coordinates"        
## [54,] "query_mongoDB"                     "connect_mongoDB"                
## [55,] "remove_chip_ID_from_list_names"    "%>%"                            
## [56,] "remove_chip_ID_from_list_names"    "remove_string_from_list_names"  
## [57,] "remove_list_element_by_name"       "%>%"                            
## [58,] "remove_list_element_by_name"       "remove_values_from_vector"      
## [59,] "subset_list_by_name"               "check_element_of_vec1_in_vec2"  
## [60,] "write_lines_task"                  "%>%"                            
## [61,] "write_lines_task"                  "filling_rule"
adja_matrix <-igraph::as_adjacency_matrix(ig)
adja_matrix
## 54 x 54 sparse Matrix of class "dgCMatrix"
##    [[ suppressing 54 column names '%>%', 'calculate_distance_parameters', 'check.if.valid' ... ]]
##                                                                                
## %>%                                   . . . . . . . . . . . . . . . . . . . . .
## calculate_distance_parameters         1 . . . . . . . . . . . 1 . . . . . 1 . .
## check.if.valid                        . . . . . . . . . . . . . . . . . . . . .
## check_element_of_vec1_in_vec2         . . . . . . . . . . . . . . . . . . . . .
## connect_mongoDB                       . . . . . . . . . . . . . . . . . . . . .
## copy_file_positionCSV                 1 . . . . . . . . . . . . . . . . . . . .
## count_cells_in_gates                  1 . . . . . . . . . . . . . . . . . . . .
## create_data_all                       1 . . . . . . . . . . . . . . . . . . . .
## create_data_coordinates               1 . . . . . . . . . . . . . . . . . . . .
## create_data_gates                     1 . . . . . . . . . . . . . . . . . . . .
## create_data_IDs_combination           1 . . . . . . . . . . . . . . . . . . . .
## create_distance_input                 . . . . . . . 1 1 1 1 . . 1 . . . 1 . . .
## create_filename_distance_result       1 . . . . . . . . . . . . . . . . . . . .
## create_gate_combinations              1 . . . . . . . . . . . . . . . . 1 . . .
## create_gatePosTogate_distInput        . . . . . . . . . 1 . . 1 . . . . . 1 . .
## create_gateTogate_distInput           . . . . . . . . . 1 . . 1 . . . . . 1 . .
## create_ID_combination_list            . . . . . . . . . . . . . . . . . . . . .
## create_n_cells_gate                   1 . . . . . . . . . . . . . . . . . . . .
## create_path_distance_result           1 . . . . . . . . . . . . . . . . . . . .
## create_XML_filename                   . . . . . . . . . . . . . . . . . . . . .
## create_XML_filepath_from_volume       . . . . . . . . . . . . . . . . . . . 1 .
## determine_length_per_list             1 . . . . . . . . . . . . . . . . . . . .
## determine_n_group                     1 . . . . . . . . . . . . . . . . . . . .
## execute_RJob_distance_calculation     . . . . . . . . . . . 1 . . . . . . . . .
## execute_RJob_mainscript               . . . . . 1 . . . . . . . . . . . . . . .
## extract_chip_IDs                      . . . . . . . . . . . . . . . . . . . . .
## extract_dist_results                  1 . . . . . . . . . . . . . . . . . . . .
## extract_files_to_process              . . . . . . . . . . . . . . . . . . . . .
## extract_gate_names                    . . . . . . . . . . . . . . . . . . . . .
## extract_gates_to_process              . . . . . . . . . . . . . . . . . . . . .
## extract_jobtype                       . . . . . . . . . . . . . . . . . . . . .
## filling_rule                          . . . . . . . . . . . . . . . . . . . . .
## find_chip_path                        1 . . . . . . . . . . . . . . . . . . . .
## find_RService_XML_on_imageserver      . . . . . . . . . . . . . . . . . . . 1 .
## find_server_path                      1 . . . . . . . . . . . . . . . . . . . .
## handle_trycatch_error                 . . . . . . . . . . . . . . . . . . . . .
## list_dist_results                     . . . . . . . . . . . . . . . . . . . . .
## list_sublist_selected_by_element_name . . . . . . . . . . . . . . . . . . . . .
## load_mainscript_output                1 . . . . . . . . . . . . . . . . . . . .
## logging_entire_input                  . . . . . . . . . . . . . . . . . . . . .
## logging_parameters                    . . . . . . . . . . . . . . . . . . . . .
## logging_paths                         . . . . . . . . . . . . . . . . . . . . .
## logging_selections                    . . . . . . . . . . . . . . . . . . . . .
## logging_UIDs                          . . . . . . . . . . . . . . . . . . . . .
## plot_distance_results                 1 . . . . . . 1 1 . . . . . . . . . . . .
## print_user_input                      . . . . . . . . . . . . . . . . . . . . .
## query_mongoDB                         . . . . 1 . . . . . . . . . . . . . . . .
## remove_chip_ID_from_list_names        1 . . . . . . . . . . . . . . . . . . . .
## remove_list_element_by_name           1 . . . . . . . . . . . . . . . . . . . .
## remove_string_from_list_names         . . . . . . . . . . . . . . . . . . . . .
## remove_values_from_vector             . . . . . . . . . . . . . . . . . . . . .
## subset_list_by_name                   . . . 1 . . . . . . . . . . . . . . . . .
## validate_user_input                   . . . . . . . . . . . . . . . . . . . . .
## write_lines_task                      1 . . . . . . . . . . . . . . . . . . . .
##                                                                                
## %>%                                   . . . . . . . . . . . . . . . . . . . . .
## calculate_distance_parameters         . . . . . . . . . . . . . . . . . . . . .
## check.if.valid                        . . . . . . . . . . . . . . . . . . . . .
## check_element_of_vec1_in_vec2         . . . . . . . . . . . . . . . . . . . . .
## connect_mongoDB                       . . . . . . . . . . . . . . . . . . . . .
## copy_file_positionCSV                 . . . . . . . . . . . . . . . . . . . . .
## count_cells_in_gates                  . . . . . . . . . . . . . . . . . . . . .
## create_data_all                       . . . . . . . . . . . . . . . . . . . . .
## create_data_coordinates               . . . . . . . . . . . . . . . . . . . . .
## create_data_gates                     . . . . . . . . . . . . . . . . . . . . .
## create_data_IDs_combination           . . . . . . . . . . . . . . . . . . . . .
## create_distance_input                 . 1 . . . . . . . . . . . . . . . . . . .
## create_filename_distance_result       . . . . . . . . . . . . . . . . . . . . .
## create_gate_combinations              . . . . . . . . . . . . . . . . . . . . .
## create_gatePosTogate_distInput        . . . . . . . . . . . . . . . . . . . . .
## create_gateTogate_distInput           . . . . . . . . . . . . . . . . . . . . .
## create_ID_combination_list            . . . . . . . . . . . . . . . . . . . . .
## create_n_cells_gate                   . . . . . . . . . . . . . . . . . . . . .
## create_path_distance_result           . . . . . . . . . . . . . . . . . . . . .
## create_XML_filename                   . . . . . . . . . . . . . . . . . . . . .
## create_XML_filepath_from_volume       . . . . . . . . . . . . . . . . . . . . .
## determine_length_per_list             . . . . . . . . . . . . . . . . . . . . .
## determine_n_group                     . . . . . . . . . . . . . . . . . . . . .
## execute_RJob_distance_calculation     . . . . . . . . . . . . . . . . . . . . .
## execute_RJob_mainscript               . . . . . . . . . . . . . . . . . . . . .
## extract_chip_IDs                      . . . . . . . . . . . . . . . . . . . . .
## extract_dist_results                  . . . . . . . . . . . . . . . . . . . . .
## extract_files_to_process              . . . . . . . . . . . . . . . . . . . . .
## extract_gate_names                    . . . . . . . . . . . . . . . . . . . . .
## extract_gates_to_process              . . . . . . . . . . . . . . . . . . . . .
## extract_jobtype                       . . . . . . . . . . . . . . . . . . . . .
## filling_rule                          . . . . . . . . . . . . . . . . . . . . .
## find_chip_path                        . . . . . . . . . . . . . 1 . . . . . . .
## find_RService_XML_on_imageserver      . . . . . . . . . . . 1 . 1 . . . . . . .
## find_server_path                      . . . . . . . . . . . . . . . . . . . . .
## handle_trycatch_error                 . . . . . . . . . . . . . . . . . . . . .
## list_dist_results                     . . . . . . . . . . . . . . . . . . . . .
## list_sublist_selected_by_element_name . . . . . . . . . . . . . . . . . . . . .
## load_mainscript_output                . . . . . . . . . . . . . . . . . . . . .
## logging_entire_input                  . . . . . . . . . . . . . . . . . . . 1 1
## logging_parameters                    . . . . . . . . . . . . . . . . . . . . .
## logging_paths                         . . . . . . . . . . . . . . . . . . . . .
## logging_selections                    . . . . . . . . . . . . . . . . . . . . .
## logging_UIDs                          . . . . . . . . . . . . . . . . . . . . .
## plot_distance_results                 . . . . . . . . . . . . . . . . . . . . .
## print_user_input                      . . . . . . . . . . . . . . . . . . . . .
## query_mongoDB                         . . . . . . . . . . . . . . . . . . . . .
## remove_chip_ID_from_list_names        . . . . . . . . . . . . . . . . . . . . .
## remove_list_element_by_name           . . . . . . . . . . . . . . . . . . . . .
## remove_string_from_list_names         . . . . . . . . . . . . . . . . . . . . .
## remove_values_from_vector             . . . . . . . . . . . . . . . . . . . . .
## subset_list_by_name                   . . . . . . . . . . . . . . . . . . . . .
## validate_user_input                   . . . . . . . . . . . . . . . . . . . . .
## write_lines_task                      . . . . . . . . . . 1 . . . . . . . . . .
##                                                              
## %>%                                   . . . . . . . . . . . .
## calculate_distance_parameters         . . . . . . . . . . . .
## check.if.valid                        . . . . . . . . . . . .
## check_element_of_vec1_in_vec2         . . . . . . . . . . . .
## connect_mongoDB                       . . . . . . . . . . . .
## copy_file_positionCSV                 . . . . . . . . . . . .
## count_cells_in_gates                  . . . . . . . . . . . .
## create_data_all                       . . . . . 1 1 . . 1 . .
## create_data_coordinates               . . . . . . . . . . . .
## create_data_gates                     . . . . . 1 . . . . . .
## create_data_IDs_combination           . . . . . . . . . . . .
## create_distance_input                 . . . . . . . . . . . .
## create_filename_distance_result       . . . . . . . . . . . .
## create_gate_combinations              . . . . . . . . . . . .
## create_gatePosTogate_distInput        . . . . . . . . . . . .
## create_gateTogate_distInput           . . . . . . . . . . . .
## create_ID_combination_list            . . . . . . . . . . . .
## create_n_cells_gate                   . . . . . . . . . . . .
## create_path_distance_result           . . . . . . . . . . . .
## create_XML_filename                   . . . . . . . . . . . .
## create_XML_filepath_from_volume       . . . . . . . . . . . .
## determine_length_per_list             . . . . . . . . . . . .
## determine_n_group                     . . . . . . . . . . . .
## execute_RJob_distance_calculation     . . . . . . . . . . . .
## execute_RJob_mainscript               . . . . . . . . . . . .
## extract_chip_IDs                      . . . . . . . . . . . .
## extract_dist_results                  . . . . . . . . . . . .
## extract_files_to_process              . . . . . . . . . . . .
## extract_gate_names                    . . . . . . . . . . . .
## extract_gates_to_process              . . . . . . . . . . . .
## extract_jobtype                       . . . . . . . . . . . .
## filling_rule                          . . . . . . . . . . . .
## find_chip_path                        . . . . . . . . . . . .
## find_RService_XML_on_imageserver      . . . . . . . . . . . .
## find_server_path                      . . . . 1 . . . . . . .
## handle_trycatch_error                 . . . . . . . . . . . .
## list_dist_results                     . . . . . . . . . . . .
## list_sublist_selected_by_element_name . . . . . . . . . . . .
## load_mainscript_output                . . . . . . . . . . . 1
## logging_entire_input                  1 1 . . . . . . . . . .
## logging_parameters                    . . . . . . . . . . . .
## logging_paths                         . . . . . . . . . . . .
## logging_selections                    . . . . . . . . . . . .
## logging_UIDs                          . . . . . . . . . . . .
## plot_distance_results                 . . . . . . . . . . . .
## print_user_input                      . . . . . . . . . . . .
## query_mongoDB                         . . . . . . . . . . . .
## remove_chip_ID_from_list_names        . . . . . . . 1 . . . .
## remove_list_element_by_name           . . . . . . . . 1 . . .
## remove_string_from_list_names         . . . . . . . . . . . .
## remove_values_from_vector             . . . . . . . . . . . .
## subset_list_by_name                   . . . . . . . . . . . .
## validate_user_input                   . . . . . . . . . . . .
## write_lines_task                      . . . . . . . . . . . .
g_network<-network::as.network(adja_matrix)
## <sparse>[ <logic> ] : .M.sub.i.logical() maybe inefficient
plot(g_network)

g_tbl <- tidygraph::as_tbl_graph(ig)
g_tbl
## # A tbl_graph: 54 nodes and 61 edges
## #
## # A directed acyclic simple graph with 14 components
## #
## # Node Data: 54 x 2 (active)
##   name                          package           
##   <chr>                         <chr>             
## 1 %>%                           RJobDistanceMetric
## 2 calculate_distance_parameters RJobDistanceMetric
## 3 check.if.valid                RJobDistanceMetric
## 4 check_element_of_vec1_in_vec2 RJobDistanceMetric
## 5 connect_mongoDB               RJobDistanceMetric
## 6 copy_file_positionCSV         RJobDistanceMetric
## # ... with 48 more rows
## #
## # Edge Data: 61 x 3
##    from    to weight
##   <int> <int>  <dbl>
## 1     2     1      1
## 2     2    13      1
## 3     2    19      1
## # ... with 58 more rows
ggraph(g_tbl) + geom_edge_link() + geom_node_point() + theme_graph()
## Using `sugiyama` as default layout

ggraph(g_tbl, layout = "graphopt") + 
  geom_node_point() +
  geom_edge_link(aes(width = weight), alpha = 0.8) + 
 # scale_edge_width(range = c(0.2, 2)) +
  geom_node_text(aes(label = name), repel = FALSE) 

# + labs(edge_width = "Letters") +
#  theme_graph()

#autograph(g_tbl)
install.packages("visNetwork")

# devtools::install_github("datastorm-open/visNetwork") for development version

require(visNetwork)
?visNetwork

# minimal example
nodes <- data.frame(id = 1:3)
edges <- data.frame(from = c(1,2), to = c(1,3))
visNetwork(nodes, edges)

# vignette
vignette("Introduction-to-visNetwork")

# full javascript documentation
visDocumentation()

# shiny example
shiny::runApp(system.file("shiny", package = "visNetwork"))
nodes <-data.frame(label=g@nodes,id = 0 : (length(g@nodes)-1)
                   
                        )

edges <- data.frame(from_name=edgelist[,1],
                      to_name=edgelist[,2],
                      width=1)

edges$from <- nodes$id[match(edges$from_name,nodes$label)]#%>%left_join(nodes,by("label"="from_name"))]
edges$source = edges$from
edges$to <- nodes$id[match(edges$to_name,nodes$label)]
edges$target = edges$to
visNetwork(nodes, edges) %>% 
  visEdges(arrows = "middle") %>%
  visNodes(shape = "square", title = "I'm a node", borderWidth = 3)%>% 
  visIgraphLayout(layout = "layout_with_fr") 
forceNetwork(Links = edges, Nodes = nodes, Source = "source", Target = "target", 
             NodeID = "id",Group = "label")#, Value = "weight")%
## Warning: It looks like Source/Target is not zero-indexed. This is required in
## JavaScript and so your plot may not render.
             #opacity = 1, fontSize = 16, zoom = TRUE)%>% 
  #saveNetwork(file = 'network3d.html')
  #dev.off()

  #sankeyNetwork(Links = edges, Nodes = nodes, Source = "source", Target = "target", 
  #            NodeID = "id", fontSize = 16)%>% 
  #saveNetwork(file = 'network3d_sankey.html')
# Load data
data(MisLinks)
data(MisNodes)
# Create graph
forceNetwork(Links = MisLinks, Nodes = MisNodes, Source = "source",
             Target = "target", Value = "value", NodeID = "name",
             Group = "group", opacity = 0.4, zoom = TRUE)

?sankeyNetwork(Links = MisLinks, Nodes = MisNodes, Source = "source",
             Target = "target", Value = "value", NodeID = "name")
ggraph(ig) + 
     geom_edge_link0(edge_colour = "#A8A8A8", edge_width = 0.8, edge_alpha = 1, arrow = arrow(angle = 30, length = unit(0.15, "inches"), ends = "last", type = "closed")) + 
    geom_node_point(fill = "#525252", colour = "#000000", size = 5, stroke = 0.3, shape = 21) + 
     geom_node_text(aes(label = name), colour = "#000000", size = 6, family = "serif") + 
     theme_graph() + 
    theme(legend.position = "none")
## Using `sugiyama` as default layout

interactive tools

Shiny Integration

To present the interactive results to our customers, we want to integrate them into a Shiny app. Therefore we prepare the data „offline“, save the nodes and edges files and create the output inside the Shiny app „online“. Here is a minimal example code of the scheme you can use for Shiny:

global.R:

library(shiny) library(visNetwork)

server.R:

shinyServer(function(input, output) { output$network <- renderVisNetwork({ load(“nodes.RData”) load(“edges.RData”)

visNetwork(nodes, edges) %>%
  visIgraphLayout()

}) })

ui.R:

shinyUI( fluidPage( visNetworkOutput(“network”) ) )

sna addin

  • rstudio graph plotting tool

devtools::install_github(“schochastics/snahelper”) devtools::install_github(“schochastics/smglr”)

ggnet und ggnet2

https://briatte.github.io/ggnet/ devtools::install_github(“briatte/ggnet”)

access function infos

input variables

  • formals
  • kimisc package
  • modules package
scf <- RJobDistanceMetric::calculate_distance_parameters
args(scf)
## function (From_IDs, To_IDs, filename = NULL, From_gate = NULL, 
##     To_gate = NULL, data_coordinates, knn = 1, dist_summary = FALSE, 
##     radius = NULL, export_knn = FALSE, message = FALSE, remove_zero_distances = TRUE, 
##     output_dir) 
## NULL
args(RJobDistanceMetric::calculate_distance_parameters)
## function (From_IDs, To_IDs, filename = NULL, From_gate = NULL, 
##     To_gate = NULL, data_coordinates, knn = 1, dist_summary = FALSE, 
##     radius = NULL, export_knn = FALSE, message = FALSE, remove_zero_distances = TRUE, 
##     output_dir) 
## NULL
argsAnywhere(RJobDistanceMetric::calculate_distance_parameters)
## Warning in find(x, numeric = TRUE): elements of 'what' after the first will be
## ignored
## function (pkg, name) 
## NULL
input <- formals(RJobDistanceMetric::calculate_distance_parameters)%>%
  kimisc::list_to_df()
## `kimisc::list_to_df()` is deprecated, use `tibble::enframe()` instead.
input
m1 <- modules::import(RJobDistanceMetric)
## Masking (modules:RJobDistanceMetric):
##   `%>%` from: package:tidygraph, package:forcats, package:stringr, package:dplyr, package:purrr, package:tidyr, package:tibble, package:visNetwork, package:RJobDistanceMetric
##   `calculate_distance_parameters` from: package:RJobDistanceMetric
##   `check.if.valid` from: package:RJobDistanceMetric
##   `check_element_of_vec1_in_vec2` from: package:RJobDistanceMetric
##   `connect_mongoDB` from: package:RJobDistanceMetric
##   `copy_file_positionCSV` from: package:RJobDistanceMetric
##   `count_cells_in_gates` from: package:RJobDistanceMetric
##   `create_data_all` from: package:RJobDistanceMetric
##   `create_data_coordinates` from: package:RJobDistanceMetric
##   `create_data_gates` from: package:RJobDistanceMetric
##   `create_data_IDs_combination` from: package:RJobDistanceMetric
##   `create_distance_input` from: package:RJobDistanceMetric
##   `create_filename_distance_result` from: package:RJobDistanceMetric
##   `create_gate_combinations` from: package:RJobDistanceMetric
##   `create_gatePosTogate_distInput` from: package:RJobDistanceMetric
##   `create_gateTogate_distInput` from: package:RJobDistanceMetric
##   `create_ID_combination_list` from: package:RJobDistanceMetric
##   `create_n_cells_gate` from: package:RJobDistanceMetric
##   `create_path_distance_result` from: package:RJobDistanceMetric
##   `create_XML_filename` from: package:RJobDistanceMetric
##   `create_XML_filepath_from_volume` from: package:RJobDistanceMetric
##   `determine_length_per_list` from: package:RJobDistanceMetric
##   `determine_n_group` from: package:RJobDistanceMetric
##   `execute_RJob_distance_calculation` from: package:RJobDistanceMetric
##   `execute_RJob_mainscript` from: package:RJobDistanceMetric
##   `extract_chip_IDs` from: package:RJobDistanceMetric
##   `extract_dist_results` from: package:RJobDistanceMetric
##   `extract_files_to_process` from: package:RJobDistanceMetric
##   `extract_gate_names` from: package:RJobDistanceMetric
##   `extract_gates_to_process` from: package:RJobDistanceMetric
##   `extract_jobtype` from: package:RJobDistanceMetric
##   `filling_rule` from: package:RJobDistanceMetric
##   `find_chip_path` from: package:RJobDistanceMetric
##   `find_RService_XML_on_imageserver` from: package:RJobDistanceMetric
##   `find_server_path` from: package:RJobDistanceMetric
##   `gates` from: package:RJobDistanceMetric
##   `handle_trycatch_error` from: package:RJobDistanceMetric
##   `input` from: package:RJobDistanceMetric
##   `list_dist_results` from: package:RJobDistanceMetric
##   `list_sublist_selected_by_element_name` from: package:RJobDistanceMetric
##   `load_mainscript_output` from: package:RJobDistanceMetric
##   `logging_entire_input` from: package:RJobDistanceMetric
##   `logging_parameters` from: package:RJobDistanceMetric
##   `logging_paths` from: package:RJobDistanceMetric
##   `logging_selections` from: package:RJobDistanceMetric
##   `logging_UIDs` from: package:RJobDistanceMetric
##   `plot_distance_results` from: package:RJobDistanceMetric
##   `PositionCSV` from: package:RJobDistanceMetric
##   `print_user_input` from: package:RJobDistanceMetric
##   `query_mongoDB` from: package:RJobDistanceMetric
##   `remove_chip_ID_from_list_names` from: package:RJobDistanceMetric
##   `remove_list_element_by_name` from: package:RJobDistanceMetric
##   `remove_string_from_list_names` from: package:RJobDistanceMetric
##   `remove_values_from_vector` from: package:RJobDistanceMetric
##   `subset_list_by_name` from: package:RJobDistanceMetric
##   `validate_user_input` from: package:RJobDistanceMetric
##   `write_lines_task` from: package:RJobDistanceMetric
##   `xml.dir` from: package:RJobDistanceMetric
m1
## <environment: 0x000000002979d0e0>
## attr(,"name")
## [1] "modules:RJobDistanceMetric"
m1%>%class
## [1] "environment"
m1%>%ls()
##  [1] "%>%"                                  
##  [2] "calculate_distance_parameters"        
##  [3] "check.if.valid"                       
##  [4] "check_element_of_vec1_in_vec2"        
##  [5] "connect_mongoDB"                      
##  [6] "copy_file_positionCSV"                
##  [7] "count_cells_in_gates"                 
##  [8] "create_data_all"                      
##  [9] "create_data_coordinates"              
## [10] "create_data_gates"                    
## [11] "create_data_IDs_combination"          
## [12] "create_distance_input"                
## [13] "create_filename_distance_result"      
## [14] "create_gate_combinations"             
## [15] "create_gatePosTogate_distInput"       
## [16] "create_gateTogate_distInput"          
## [17] "create_ID_combination_list"           
## [18] "create_n_cells_gate"                  
## [19] "create_path_distance_result"          
## [20] "create_XML_filename"                  
## [21] "create_XML_filepath_from_volume"      
## [22] "determine_length_per_list"            
## [23] "determine_n_group"                    
## [24] "execute_RJob_distance_calculation"    
## [25] "execute_RJob_mainscript"              
## [26] "extract_chip_IDs"                     
## [27] "extract_dist_results"                 
## [28] "extract_files_to_process"             
## [29] "extract_gate_names"                   
## [30] "extract_gates_to_process"             
## [31] "extract_jobtype"                      
## [32] "filling_rule"                         
## [33] "find_chip_path"                       
## [34] "find_RService_XML_on_imageserver"     
## [35] "find_server_path"                     
## [36] "gates"                                
## [37] "handle_trycatch_error"                
## [38] "input"                                
## [39] "list_dist_results"                    
## [40] "list_sublist_selected_by_element_name"
## [41] "load_mainscript_output"               
## [42] "logging_entire_input"                 
## [43] "logging_parameters"                   
## [44] "logging_paths"                        
## [45] "logging_selections"                   
## [46] "logging_UIDs"                         
## [47] "plot_distance_results"                
## [48] "PositionCSV"                          
## [49] "print_user_input"                     
## [50] "query_mongoDB"                        
## [51] "remove_chip_ID_from_list_names"       
## [52] "remove_list_element_by_name"          
## [53] "remove_string_from_list_names"        
## [54] "remove_values_from_vector"            
## [55] "subset_list_by_name"                  
## [56] "validate_user_input"                  
## [57] "write_lines_task"                     
## [58] "xml.dir"
l1 <- m1%>%as.list()
class(l1)
## [1] "list"
is.function(l1[[1]])
## [1] TRUE
formals(l1[[1]])
## $df
## 
## 
## $grouping_var
## c("Position")
## 
## $column_name
## [1] "n_cells"
## 
## $object_name
## [1] "cells_per_gate"
## 
## $print_data
## [1] TRUE
args(formals(l1[[1]]))
## NULL
e1 <- data.frame(function_name = names(l1),
                 is_function =purrr::map_lgl(l1,~is.function(.x)))%>%
  dplyr::mutate(input_variables =purrr::map(l1,~formals(.x)))
## Warning in formals(fun): argument is not a function

## Warning in formals(fun): argument is not a function

## Warning in formals(fun): argument is not a function

## Warning in formals(fun): argument is not a function
e2<-e1%>%
  dplyr::mutate(variable_names =purrr::map(input_variables,~names(.x)),
                variable_values =purrr::map(input_variables,~paste0(.x)))

e3<- e2%>%
  dplyr::filter(is_function==TRUE)%>%
  dplyr::select(function_name,variable_names,variable_values)

e4 <- e3%>%
  mutate(is_oblig_var = map(variable_values,~.x==""))

e5 <- e4%>%unnest(cols = c(variable_names, variable_values, is_oblig_var))
e5

functions dependency report